<!--
 * @Author: shaohang-shy
 * @Date: 2021-02-27 17:45:14
 * @lastEditors: shaohang-shy
 * @LastEditTime: 2021-02-27 20:56:21
 * @Description: demo08 red
-->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <script src="../build/react.development.js"></script>
    <script src="../build/react-dom.development.js"></script>
    <script src="../build/babel.min.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">
      class MyComponent extends React.Component {
        handleClick() {
          this.refs.myTextInput.focus();
        }
        render() {
          return (
            <div>
              <input type="text" ref="myTextInput" />
              <input
                type="button"
                value="Focus the text input"
                onClick={() => this.handleClick()}
              />
            </div>
          );
        }
      }

      ReactDOM.render(<MyComponent />, document.getElementById("root"));
    </script>
  </body>
</html>
